import React from 'react';
import {Checkbox} from 'antd';
const CheckboxGroup = Checkbox.Group;
import {WeaSearchGroup, WeaFormItem} from 'ecCom';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import EType from './base/EType';
import ETitle from './base/ETitle';
import EShowNum from './base/EShowNum';
import ELinkMode from './base/ELinkMode';
import EField from './base/EField';

// 未读协作
export default class Content_13 extends React.Component {
    state = {
        eShowContent: this.props.eShowContent.checked
    };

    render() {
        const {eShowContent} = this.state;

        let EShowContent = <div></div>;
        if (this.props.eShareLevel == '2') {
            EShowContent = (
                <WeaFormItem label={getLabel(15935, '显示内容')} labelCol={{span: 6}} wrapperCol={{span: 16}}>
                    <CheckboxGroup size="default" options={this.props.eShowContent.options} value={eShowContent} onChange={checkedValue => this.setState({eShowContent: checkedValue})}/>
                </WeaFormItem>
            );
        }

        return (
            <div>
                <WeaSearchGroup title={getLabel(81711, '基本信息')} needTigger={true} showGroup={true}>
                    <EType ref="eType" value={this.props.eBaseName}/>
                    {this.props.eShareLevel == '2' ? <ETitle ref="eTitle" eid={this.props.eid} value={this.props.eTitle}  {...this.props}/> : ''}
                    <EShowNum ref="eShowNum" value={this.props.eShowNum}/>
                    <ELinkMode ref="eLinkMode" options={this.props.eLinkMode.options} value={this.props.eLinkMode.selected}/>
                    <EField ref="eField" value={this.props.eField}/>
                    {EShowContent}
                </WeaSearchGroup>
            </div>
        );
    }

    getSaveValues() {
        return {
            eContentTitle: this.refs['eTitle'] ? this.refs['eTitle'].getSaveValues() : this.props.eTitle,
            eContentShowNum: this.refs['eShowNum'].getSaveValues(),
            eContentLinkMode: this.refs['eLinkMode'].getSaveValues(),
            eContentField: this.refs['eField'].getSaveValues(),
            eContentShowContent: this.state.eShowContent,
            eContentTabWidth: {tabwidth: this.props.etabwidth, methodvalue: this.props.methodvalue},
            eContentIsAlwaysShow: this.props.isAlwaysShow,
            eContenteTabStyle: {tabstyle: this.props.tabstyle, tabvalue: this.props.tabvalue, tabname: this.props.tabname},
        };
    }
}